<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8>
<title>客户管理系统</title>
<base href="<%=basePath%>">
<link rel="stylesheet" type="text/css"
	href="bootstrap-rs/themes/black/easyui.css">
<link rel="stylesheet" type="text/css"
	href="bootstrap-rs/themes/icon.css">
<link rel="stylesheet" type="text/css" href="bootstrap-rs/demo.css">
<script type="text/javascript" src="bootstrap-rs/jquery.min.js"></script>
<script type="text/javascript" src="bootstrap-rs/jquery.easyui.min.js"></script>
</head>
<body>
	<table id="dg" class="easyui-datagrid" title="Basic DataGrid"
		data-options="url:'sys/user/queryData'
			,fit:true,fitColumns:true,pagination:true,pagePosition:'bottom',rownumbers:true
			,scrollbarSize:0">
		<thead>
			<tr>
				<th field="ck" checkbox="true"></th>
				<th data-options="field:'nUserid',width:80">用户id</th>
				<th data-options="field:'vUsername',width:100">用户名</th>
				<th data-options="field:'vRealname',width:80,align:'right'">真实姓名</th>
				<th data-options="field:'vSex',width:80,align:'right'">性别</th>
				<th data-options="field:'vBirthplace',width:250">籍贯</th>
				<th data-options="field:'vIndetification',width:60,align:'center'">身份证</th>
				<th data-options="field:'nMobile',width:60,align:'center'">电话号码</th>
				<th data-options="field:'nTelphone',width:60,align:'center'">手机号码</th>
				<th data-options="field:'vEmail',width:60,align:'center'">邮箱</th>
			</tr>
		</thead>
	</table>
	<div id="tb" style="padding:2px 15px">
		<input id="message" class="abc input-default" name="message"
			placeholder="账号/姓名查询" value="${message }"
			style="width:160px;height:32px"> <a onclick="mohuquery()"
			class="easyui-linkbutton" data-options="iconCls:'icon-search'"
			style="width:80px">Search</a> <a href="sys/user/insert"
			class="easyui-linkbutton" data-options="iconCls:'icon-add'"
			style="width:80px">Add</a> <a id="update" href="javascript:void(0)"
			class="easyui-linkbutton" data-options="iconCls:'icon-edit'"
			style="width:80px">Update</a> <a id="delete"
			href="javascript:void(0)" class="easyui-linkbutton"
			data-options="iconCls:'icon-remove'" style="width:80px">Remove</a>
	</div>
	<div class="inline pull-right page">
		<!-- basePage没有作用 -->
		<jsp:include page="/pageBar.jsp"></jsp:include>
	</div>
</body>
<script type="text/javascript">
	$('#dg').datagrid({
		toolbar : '#tb'
	});

	$('#delete').click(function() {
		var ids = [];
		var rows = $('#dg').datagrid('getSelections');

		for (var i = 0; i < rows.length; i++) {
			ids.push(rows[i].nUserid);
		}
		var idsString = JSON.stringify(ids);
		$.post('sys/user/delete', {
			'ids' : idsString.toString()
		}, function() {
			window.location.href = 'sys/user/query'
		})
	})
	$('#update').click(function() {

		var rows = $('#dg').datagrid('getSelections');
		window.location.href = 'sys/user/updateData?id=' + rows[0].nUserid;
	})
	$('#search').click(function() {

		window.location.href = 'sys/user/search'

	})

	function mohuquery() {
		var msg = document.getElementById("message").value;
		$('#dg').datagrid({
			url : 'sys/user/queryData?message=' + msg
		})
	}
</script>

</html>